﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Nova_BLL;
using Nova_Common;

public partial class Top : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string vUserName = "";
        string vDepartment = "";

        Nova_BLL.Users Nova_BLL_Users = new Nova_BLL.Users();

        if (!IsPostBack)
        {
            HttpCookie Cookie = Request.Cookies["vNovaUserNo"];

            if (Cookie !=null || Cookie!=null && Cookie.ToString()!="")
            {
                try
                {
                    vUserName = Nova_BLL_Users.CallBackUserName(Request.Cookies["vNovaUserNo"].Value.ToString());
                    lblUserName.Text = vUserName.ToString();
                    vDepartment = Nova_BLL_Users.CallBackDepartment(Request.Cookies["vNovaUserNo"].Value.ToString());
                    lblGroup.Text = vDepartment.ToString();

                }
                catch (Exception ex)
                {
                    Response.Write(ex.ToString());
                }
            }
        }
    }

    /// <summary>
    /// 退出
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void ibtnOut_Click(object sender, ImageClickEventArgs e)
    {
        HttpCookie Cookie = Request.Cookies["vNovaUserNo"];

        Cookie.Expires = DateTime.Now.AddDays(-1);

        Response.AppendCookie(Cookie); 

        Response.Write("<script language='javascript'>parent.document.location.href='Login.aspx'</script>");  
    }

}
